package com.woniuxy.api;

import com.woniu.cloud.common.dto.Result;
import com.woniuxy.entity.GoodOrder;

import com.woniuxy.form.GetAfterSaleByPlatform;
import com.woniuxy.form.GetGoodOrderForm;
import com.woniuxy.form.GetOrder;
import com.woniuxy.form.InsertGoodOrder;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "kaer-order",contextId = "GoodOrderApi")
public interface GoodOrderApi {

    /**
     *
     * @param pageSize  总页数
     * @param indexPage  分页查询页数
     * @return  data: ipage
     *
     *  用户分页查询商品订单
     */
    @GlobalTransactional
    @GetMapping("/getGoodOrderByUserId")
    Result getGoodOrderByUserId(@RequestParam(value = "indexPage") Integer indexPage,@RequestParam(value = "pageSize") Integer pageSize,@RequestParam("userId") Integer userId);

    @GetMapping("/getGoodOrderById")
    Result getGoodOrderById(@RequestParam("id") Integer id);
    /**
     *
     * @param getAfterSaleByPlatform  分页页数
     * @return
     *
     * 门店查询商品订单
     */
    @GlobalTransactional
    @GetMapping("/getGoodOrderByStore")
    Result getGoodOrderByStore(@RequestBody GetAfterSaleByPlatform getAfterSaleByPlatform);


    /**
     *
     * @param getAfterSaleByPlatform  分页查询页数
     * @return data:ipage
     * 平台分页查询所有用户订单
     *
     */
    @GlobalTransactional
    @GetMapping("/getGoodOrderByPlatform")
    Result getGoodOrderByPlatform(@RequestBody GetAfterSaleByPlatform getAfterSaleByPlatform);

    /**
     * 多条件查询
     * @param form
     * @return
     */
    @GlobalTransactional
    @GetMapping("/getGoodOrder")
    Result getGoodOrder(@RequestBody GetGoodOrderForm form);

    /**
     *
     * @param goodOrderId 订单id
     * @param status  修改的状态 0:未付款 1:已付款  2:待自提  3: 已自提 4:已发货 5:物流中  6:已签收  7:申请退货  8:申请换货  9:退货完成  10:订单完成   11:换货完成，12：未评论  13：已评论
     * @return  bool
     *
     * 门店修改商品订单状态
     */
    @GlobalTransactional
    @PutMapping("/updateGoodOrderStatusById")
    Result updateGoodOrderStatusById(@RequestParam("goodOrderId") Integer goodOrderId,@RequestParam("status") Integer status);

    /**
     *
     * @param insertGoodOrder  要生成的商品订单
     * @return  bool
     *
     *  用户下单，生成 未付款订单   同时生成订单详情  删除购物车信息
     *
     */
    @GlobalTransactional
    @PostMapping("/insertGoodOrder")
    Result insertGoodOrder(@RequestBody InsertGoodOrder insertGoodOrder);

    @PostMapping("/updateGoodOrderPayType")
    Result updateGoodOrderPayType(@RequestParam("orderId") Integer orderId ,@RequestParam("payType") Integer payType);
    /**
     *
     * @param goodOrderId 商品订单号
     * @return
     * 用户取消订单  把订单状态改为 取消
     */
    @GlobalTransactional
    @PutMapping("/updateGoodOrderStatus")
    Result updateGoodOrderStatus(@RequestParam("goodOrderId") Integer goodOrderId);

    /**
     *
     * @param goodOrderId 商品订单号
     *
     * @return
     *
     *  对该订单进行付款操作，改变订单状态为已付款
     */
    @GlobalTransactional
    @PutMapping("/updateGoodOrderPaied")
    Result updateGoodOrderPaied(@RequestParam("goodOrderId") Integer goodOrderId);

    /**
     *
     * @param goodOrderId 商品订单号
     * @return
     * 用户点击确认收货，将订单状态改为 已收货
     *
     */
    @GlobalTransactional
    @PutMapping("/updateGoodOrderReceiving")
    Result updateGoodOrderReceiving(@RequestParam("goodOrderId") Integer goodOrderId);


    /**
     *
     * @param goodOrderId 商品订单号
     * @return
     * 用户完成评价后，将订单状态改为 已评价
     *
     */
    @GlobalTransactional
    @PutMapping("/updateGoodOrderEvaluated")
    Result updateGoodOrderEvaluated(@RequestParam("goodOrderId") Integer goodOrderId);

}
